package com.gusto.engine.clusterant.algorithms.kmeansclustering;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.gusto.engine.clusterant.model.Point;

public class ClusterObject implements Serializable {
	
	private static final long serialVersionUID = 1L;
	 
	private int id;
	private Double row, col;
	private List<Point> components;
	
	public ClusterObject(int id, Double row, Double col) {
		this.id = id;
		this.row = row;
		this.col = col;
		components = new ArrayList<Point>();
	} 
	
	public ClusterObject(int id, Double row, Double col, List<Point> components) {
		this.id = id;
		this.row = row;
		this.col = col;
		this.components = components;
	}
	
	
	public String toString() {
		String res = "Cluster (" + (Math.round(row * 100) / 100) + "-" + (Math.round(col * 100) / 100) + ")  |";
		for (Point p : components) {
			res += p.getObject() + "|";
		}
		return res;
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	public Double getRow() {
		return row;
	}
	public void setRow(Double row) {
		this.row = row;
	}
	
	public Double getCol() {
		return col;
	}
	public void setCol(Double col) {
		this.col = col;
	}
	
	public List<Point> getComponents() {
		return components;
	}
	
}
